﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<SeaBattle.Domain.Entities.Game>>" %>

<div id="userGamesList">
    <table>
        <tbody>
            <tr>
                <th>
                    Название
                </th>
                <th>
                    Создатель
                </th>
                <th>
                    Оппонент
                </th>
                <th>
                    Ставка
                </th>
                <th>
                    Состояние
                </th>
                <th>
                    <input type="submit" onclick="updateUserGamesList()" value="Обновить" />
                </th>
            </tr>
            <%foreach (var game in Model)
              {%>
            <tr>
                <td>
                    <%:game.Name%>
                </td>
                <th>
                    <%:game.Creator.Login%>
                </th>
                <td>
                    <%if (game.Opponent != null)
                      {%>
                    <%:game.Opponent.Login%>
                    <%}%>
                </td>
                <td>
                    <%:game.Preset %>
                </td>
                <td>
                    <%:game.State %>
                </td>
                <th>
                    <input type="submit" onclick="backToGame('<%:game.Id %>')" value="Перейти" />
                </th>
            </tr>
            <%}%>
        </tbody>
    </table>
</div>